from django.db import models

# Goods
class Goods(models.Model):
    '''图片，标题，价格'''
    img = models.ImageField(upload_to='img')
    title = models.CharField(max_length=128)
    price1 = models.DecimalField(max_digits=9,decimal_places=2)
    price2 = models.DecimalField(max_digits=9,decimal_places=2)


# 用户表
class User(models.Model):
    username = models.CharField(max_length=32)
    password = models.CharField(max_length=255)



# 订单
class Order(models.Model):
    '''会员ID,商品标题，价格，姓名，手机号码'''
    user = models.ForeignKey('User',on_delete=models.CASCADE)
    goods = models.ForeignKey('Goods',on_delete=models.CASCADE)
    name = models.CharField(max_length=32)
    phone = models.CharField(max_length=32)



